<!DOCTYPE html>
<html lang="zh-CN"
      xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title>新零售微店后台首页</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link th:href="@{/layui/css/layui.css}"  rel="stylesheet">
    <link th:href="@{/style/admin.css}"  rel="stylesheet">
    <style>
        .layui-table{overflow-y: scroll;}
    </style>
</head>
<body>

<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-form layui-card-header layuiadmin-card-header-auto">
            <div class="layui-form-item">
                <!--<div class="layui-inline">-->
                    <!--<form name="form" class="form">-->
                        <!--<label class="layui-form-label"></label>-->
                        <!--<div class="layui-input-block">-->
                            <!--<div class="layui-input-inline">-->
                                <!--<select name="orderStatus" id="orderStatus"  lay-verify="required"   lay-filter="select1">-->
                                    <!--<option selected="selected" value="0">订单状态</option>-->
                                    <!--<option value="701">已生成</option>-->
                                    <!--<option value="702">已完成</option>-->
                                    <!--<option value="703">已取消</option>-->
                                <!--</select>-->
                            <!--</div>-->
                            <!--<div class="layui-input-inline">-->
                                <!--<select name="payStatus" id="payStatus" lay-filter="select2">-->
                                    <!--<option selected="selected"  value="0">支付状态</option>-->
                                    <!--<option value="801">待支付</option>-->
                                    <!--<option value="802">已支付</option>-->
                                <!--</select>-->
                            <!--</div>-->
                            <!--<div class="layui-input-inline" >-->
                                <!--<select name="deliveStatus" id="deliveStatus" lay-filter="select3">-->
                                    <!--<option selected="selected"  value="0">发货状态</option>-->
                                    <!--<option value="901">已发货</option>-->
                                    <!--<option value="902">代发货</option>-->
                                <!--</select>-->
                            <!--</div>-->
                        <!--</div>-->
                    <!--</form>-->
                <!--</div>-->
                <!--<div class="layui-inline">-->
                    <!--&lt;!&ndash;<label class="layui-form-label"></label>&ndash;&gt;-->
                    <!--<div class="layui-input-block">-->
                        <!--<input type="text" name="keywords" id="keywords" placeholder="" autocomplete="off" class="layui-input">-->
                    <!--</div>-->
                <!--</div>-->
                <!--<div class="layui-inline">-->
                    <!--<button class="layui-btn layuiadmin-btn-admin" lay-submit lay-filter="LAY-user-back-search" onclick="SelectData()">-->
                        <!--<i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>-->
                    <!--</button>-->
                <!--</div>-->
            </div>
        </div>

        <div class="layui-card-body">
            <div style="padding-bottom: 10px;">
                <button class="layui-btn layuiadmin-btn-admin" data-type="batchdel"  onclick="exportOrder();">导单</button>
                <!--<button class="layui-btn layuiadmin-btn-admin" data-type="add" onclick="WinOpenAdd();">添加</button>-->
            </div>
            <table width="80%" class="layui-table" lay-data="{url:'/getExportOrderList', id:'test3',page: true,limit:10,id: 'testReload'}" lay-filter="test3">
                <thead>
                <tr>
                    <th lay-data="{field:'id', width:100}">序号</th>
                    <!--<th lay-data="{type:'checkbox'}">ID</th>-->
                    <th lay-data="{field:'typename', width:100}">类型</th>
                    <th lay-data="{field:'number',minWidth: 100}">数量</th>
                    <th lay-data="{field:'adminName',minWidth: 100}">操作员</th>
                    <th lay-data="{field:'time',width:180,templet :function (row){return createTime(row.time);}}">导单时间</th>
                    <!--<th lay-data="{field:'url',minWidth: 90}">文件</th>-->
                    <th lay-data="{fixed: 'right', width:170, align:'center', toolbar: '#barDemo'}">操作</th>
                </tr>
                </thead>
            </table>


            <!--<table class="layui-hide" id="address"></table>-->

            <script type="text/html" id="barDemo">
                <!--<a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail" href="/getOrderDetails?No={{d.orderNo}}">查看</a>-->
                <a class="layui-btn layui-btn-xs" lay-event="edit" data="{{d.url}}" onclick="xiazai(this)"  href="#" charset="x-iso-8859-11">下载</a>
                <!--<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>-->
            </script>

        </div>
    </div>
</div>

<script th:src="@{/layui/jquery.min.js}"></script>
<script th:src="@{/layui/layui.js}"></script>
<script th:src="@{/js/order.js}"></script>
<script th:inline="javascript">
    var table;
    layui.use('table', function(){
        table = layui.table;

    });
    function exportOrder() {
          window.location="/Excel";
        setTimeout('window.location.reload()',5000);
        // //执行重载
        // table.reload('testReload', {
        //     url:"/getExportOrderList",
        //     page: {
        //         curr: 1
        //     }
        // });
    }
    function xiazai(obj) {
        var fileName=$(obj).attr("data");
        var pos=fileName.lastIndexOf("\\");
        var fname=fileName.substring(pos);
         window.location="/doExport?path="+fileName;
        // $.post("/download?path="+fileName, function(data) {
        //     $(".result").html(data);
        // });
    }
    var ststus1=0;
    var ststus2=0;
    var ststus3=0;
    var keywords="";
    var form;
    layui.use('form', function () {
        form = layui.form;
        form.on('select(select1)', function (data) {
            ststus1 = data.value;
            keywords = $("#keywords").val();
            selectAll(ststus1, ststus2, ststus3, keywords);
        });
        form.render();

        form.on('select(select2)', function (data) {
            ststus2 = data.value;
            keywords = $("#keywords").val();
            selectAll(ststus1, ststus2, ststus3, keywords);
        });
        form.render();

        form.on('select(select3)', function (data) {
            ststus3 = data.value;
            keywords = $("#keywords").val();
            selectAll(ststus1, ststus2, ststus3, keywords);
        });
        form.render();
    });
    function selectAll(status1,status2,status3,keywords) {
        //alert(status1+"--"+status2+"--"+status3+"--"+keywords);
        //执行重载
        table.reload('testReload', {
            url:"/selectOrderList?orderStatus="+status1+"&payStatus="+status2+"&deliveStatus="+status3+"&keywords="+keywords,
            page: {
                curr: 1
            }
        });
    }

    function SelectData() {
        keywords = $("#keywords").val();
        layui.use('form', function () {
            form = layui.form;
            form.on('select(select1)', function (data) {
                ststus1 = data.value;
                selectAll(ststus1, ststus2, ststus3, keywords);
            });
            form.render();

            form.on('select(select2)', function (data) {
                ststus2 = data.value;
                selectAll(ststus1, ststus2, ststus3, keywords);
            });
            form.render();

            form.on('select(select3)', function (data) {
                ststus3 = data.value;
                selectAll(ststus1, ststus2, ststus3, keywords);
            });
            selectAll(ststus1, ststus2, ststus3, keywords);
            form.render();

        });
    }
</script>
</body>
</html>

